/*
 * Copyright 2008 Neil Bacon
 * Distributed under the terms of the Mozilla Public License version 1.1
 * or the GNU General Public License version 3.
 */

package nb.xadd.node.impl;

import nb.xadd.node.Node;

/** Terminal value node in EADD tree */
public abstract class AbstractNode implements Node {

    protected AbstractNode() {
    }

    @Override
    public abstract int hashCode();

    @Override
    public int compareTo(Node other) {
        return getOrdering().compareTo(other.getOrdering());
    }

    @Override
    public int getId() {
        return super.hashCode();
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder();
        appendTo(0, buf);
        return buf.toString();
    }

}
